// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

mod debug;
mod deserialize;
mod serialize;

/// A test message for `enum` fields.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithEnum {
    /// A singular field.
    pub singular: crate::generated::message_with_enum::TestEnum,

    /// An optional field.
    pub optional: std::option::Option<crate::generated::message_with_enum::TestEnum>,

    /// A repeated field.
    pub repeated: std::vec::Vec<crate::generated::message_with_enum::TestEnum>,

    /// A map field, enums cannot be keys. We only need to test them as values.
    pub map: std::collections::HashMap<
        std::string::String,
        crate::generated::message_with_enum::TestEnum,
    >,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithEnum {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithEnum::singular].
    pub fn set_singular<T: std::convert::Into<crate::generated::message_with_enum::TestEnum>>(
        mut self,
        v: T,
    ) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithEnum::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_enum::TestEnum>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithEnum::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_enum::TestEnum>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithEnum::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::generated::message_with_enum::TestEnum>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithEnum::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::generated::message_with_enum::TestEnum>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithEnum {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithEnum"
    }
}

/// Defines additional types related to [MessageWithEnum].
pub mod message_with_enum {
    #[allow(unused_imports)]
    use super::*;

    /// The enum type
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum TestEnum {
        /// Open enums require a default value of `0`.
        Unspecified,
        /// A test value.
        Red,
        /// A test value.
        Green,
        /// A test value.
        Blue,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [TestEnum::value] or
        /// [TestEnum::name].
        UnknownValue(test_enum::UnknownValue),
    }

    #[doc(hidden)]
    pub mod test_enum {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl TestEnum {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Red => std::option::Option::Some(1),
                Self::Green => std::option::Option::Some(2),
                Self::Blue => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TEST_ENUM_UNSPECIFIED"),
                Self::Red => std::option::Option::Some("RED"),
                Self::Green => std::option::Option::Some("GREEN"),
                Self::Blue => std::option::Option::Some("BLUE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for TestEnum {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for TestEnum {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for TestEnum {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Red,
                2 => Self::Green,
                3 => Self::Blue,
                _ => Self::UnknownValue(test_enum::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for TestEnum {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TEST_ENUM_UNSPECIFIED" => Self::Unspecified,
                "RED" => Self::Red,
                "GREEN" => Self::Green,
                "BLUE" => Self::Blue,
                _ => Self::UnknownValue(test_enum::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for TestEnum {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Red => serializer.serialize_i32(1),
                Self::Green => serializer.serialize_i32(2),
                Self::Blue => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for TestEnum {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TestEnum>::new(
                ".google.rust.sdk.test.MessageWithEnum.TestEnum",
            ))
        }
    }
}

/// A message with several interesting `oneof` fields.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithOneOf {
    pub single_string: std::option::Option<crate::generated::message_with_one_of::SingleString>,

    pub two_strings: std::option::Option<crate::generated::message_with_one_of::TwoStrings>,

    pub one_message: std::option::Option<crate::generated::message_with_one_of::OneMessage>,

    pub mixed: std::option::Option<crate::generated::message_with_one_of::Mixed>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithOneOf {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [single_string][crate::generated::MessageWithOneOf::single_string].
    ///
    /// Note that all the setters affecting `single_string` are mutually
    /// exclusive.
    pub fn set_single_string<
        T: std::convert::Into<
                std::option::Option<crate::generated::message_with_one_of::SingleString>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.single_string = v.into();
        self
    }

    /// The value of [single_string][crate::generated::MessageWithOneOf::single_string]
    /// if it holds a `StringContents`, `None` if the field is not set or
    /// holds a different branch.
    pub fn string_contents(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.single_string.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::SingleString::StringContents(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [single_string][crate::generated::MessageWithOneOf::single_string]
    /// to hold a `StringContents`.
    ///
    /// Note that all the setters affecting `single_string` are
    /// mutually exclusive.
    pub fn set_string_contents<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.single_string = std::option::Option::Some(
            crate::generated::message_with_one_of::SingleString::StringContents(v.into()),
        );
        self
    }

    /// Sets the value of [two_strings][crate::generated::MessageWithOneOf::two_strings].
    ///
    /// Note that all the setters affecting `two_strings` are mutually
    /// exclusive.
    pub fn set_two_strings<
        T: std::convert::Into<std::option::Option<crate::generated::message_with_one_of::TwoStrings>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.two_strings = v.into();
        self
    }

    /// The value of [two_strings][crate::generated::MessageWithOneOf::two_strings]
    /// if it holds a `StringContentsOne`, `None` if the field is not set or
    /// holds a different branch.
    pub fn string_contents_one(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.two_strings.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::TwoStrings::StringContentsOne(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [two_strings][crate::generated::MessageWithOneOf::two_strings]
    /// to hold a `StringContentsOne`.
    ///
    /// Note that all the setters affecting `two_strings` are
    /// mutually exclusive.
    pub fn set_string_contents_one<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.two_strings = std::option::Option::Some(
            crate::generated::message_with_one_of::TwoStrings::StringContentsOne(v.into()),
        );
        self
    }

    /// The value of [two_strings][crate::generated::MessageWithOneOf::two_strings]
    /// if it holds a `StringContentsTwo`, `None` if the field is not set or
    /// holds a different branch.
    pub fn string_contents_two(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.two_strings.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::TwoStrings::StringContentsTwo(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [two_strings][crate::generated::MessageWithOneOf::two_strings]
    /// to hold a `StringContentsTwo`.
    ///
    /// Note that all the setters affecting `two_strings` are
    /// mutually exclusive.
    pub fn set_string_contents_two<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.two_strings = std::option::Option::Some(
            crate::generated::message_with_one_of::TwoStrings::StringContentsTwo(v.into()),
        );
        self
    }

    /// Sets the value of [one_message][crate::generated::MessageWithOneOf::one_message].
    ///
    /// Note that all the setters affecting `one_message` are mutually
    /// exclusive.
    pub fn set_one_message<
        T: std::convert::Into<std::option::Option<crate::generated::message_with_one_of::OneMessage>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.one_message = v.into();
        self
    }

    /// The value of [one_message][crate::generated::MessageWithOneOf::one_message]
    /// if it holds a `MessageValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn message_value(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::generated::message_with_one_of::Message>> {
        #[allow(unreachable_patterns)]
        self.one_message.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::OneMessage::MessageValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [one_message][crate::generated::MessageWithOneOf::one_message]
    /// to hold a `MessageValue`.
    ///
    /// Note that all the setters affecting `one_message` are
    /// mutually exclusive.
    pub fn set_message_value<
        T: std::convert::Into<std::boxed::Box<crate::generated::message_with_one_of::Message>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.one_message = std::option::Option::Some(
            crate::generated::message_with_one_of::OneMessage::MessageValue(v.into()),
        );
        self
    }

    /// Sets the value of [mixed][crate::generated::MessageWithOneOf::mixed].
    ///
    /// Note that all the setters affecting `mixed` are mutually
    /// exclusive.
    pub fn set_mixed<
        T: std::convert::Into<std::option::Option<crate::generated::message_with_one_of::Mixed>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.mixed = v.into();
        self
    }

    /// The value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// if it holds a `AnotherMessage`, `None` if the field is not set or
    /// holds a different branch.
    pub fn another_message(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::generated::message_with_one_of::Message>> {
        #[allow(unreachable_patterns)]
        self.mixed.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::Mixed::AnotherMessage(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// to hold a `AnotherMessage`.
    ///
    /// Note that all the setters affecting `mixed` are
    /// mutually exclusive.
    pub fn set_another_message<
        T: std::convert::Into<std::boxed::Box<crate::generated::message_with_one_of::Message>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.mixed = std::option::Option::Some(
            crate::generated::message_with_one_of::Mixed::AnotherMessage(v.into()),
        );
        self
    }

    /// The value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// if it holds a `String`, `None` if the field is not set or
    /// holds a different branch.
    pub fn string(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.mixed.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::Mixed::String(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// to hold a `String`.
    ///
    /// Note that all the setters affecting `mixed` are
    /// mutually exclusive.
    pub fn set_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mixed = std::option::Option::Some(
            crate::generated::message_with_one_of::Mixed::String(v.into()),
        );
        self
    }

    /// The value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// if it holds a `Duration`, `None` if the field is not set or
    /// holds a different branch.
    pub fn duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
        #[allow(unreachable_patterns)]
        self.mixed.as_ref().and_then(|v| match v {
            crate::generated::message_with_one_of::Mixed::Duration(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [mixed][crate::generated::MessageWithOneOf::mixed]
    /// to hold a `Duration`.
    ///
    /// Note that all the setters affecting `mixed` are
    /// mutually exclusive.
    pub fn set_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
        mut self,
        v: T,
    ) -> Self {
        self.mixed = std::option::Option::Some(
            crate::generated::message_with_one_of::Mixed::Duration(v.into()),
        );
        self
    }
}

impl wkt::message::Message for MessageWithOneOf {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithOneOf"
    }
}

/// Defines additional types related to [MessageWithOneOf].
pub mod message_with_one_of {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Message {
        pub parent: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Message {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [parent][crate::generated::message_with_one_of::Message::parent].
        pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.parent = v.into();
            self
        }
    }

    impl wkt::message::Message for Message {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rust.sdk.test.MessageWithOneOf.Message"
        }
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum SingleString {
        StringContents(std::string::String),
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum TwoStrings {
        StringContentsOne(std::string::String),
        StringContentsTwo(std::string::String),
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum OneMessage {
        MessageValue(std::boxed::Box<crate::generated::message_with_one_of::Message>),
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Mixed {
        AnotherMessage(std::boxed::Box<crate::generated::message_with_one_of::Message>),
        String(std::string::String),
        Duration(std::boxed::Box<wkt::Duration>),
    }
}

/// A message with a more complex `oneof` field.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithComplexOneOf {
    pub complex: std::option::Option<crate::generated::message_with_complex_one_of::Complex>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithComplexOneOf {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex].
    ///
    /// Note that all the setters affecting `complex` are mutually
    /// exclusive.
    pub fn set_complex<
        T: std::convert::Into<
                std::option::Option<crate::generated::message_with_complex_one_of::Complex>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.complex = v.into();
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Null`, `None` if the field is not set or
    /// holds a different branch.
    pub fn null(&self) -> std::option::Option<&wkt::NullValue> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Null(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Null`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_null<T: std::convert::Into<wkt::NullValue>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Null(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `BoolValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn bool_value(&self) -> std::option::Option<&bool> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::BoolValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `BoolValue`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::BoolValue(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `BytesValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn bytes_value(&self) -> std::option::Option<&::bytes::Bytes> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::BytesValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `BytesValue`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_bytes_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::BytesValue(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `StringValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn string_value(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::StringValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `StringValue`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::StringValue(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `FloatValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn float_value(&self) -> std::option::Option<&f32> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::FloatValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `FloatValue`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::FloatValue(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `DoubleValue`, `None` if the field is not set or
    /// holds a different branch.
    pub fn double_value(&self) -> std::option::Option<&f64> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::DoubleValue(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `DoubleValue`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::DoubleValue(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Int32`, `None` if the field is not set or
    /// holds a different branch.
    pub fn int32(&self) -> std::option::Option<&i32> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Int32(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Int32`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_int32<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Int32(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Int64`, `None` if the field is not set or
    /// holds a different branch.
    pub fn int64(&self) -> std::option::Option<&i64> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Int64(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Int64`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_int64<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Int64(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Enum`, `None` if the field is not set or
    /// holds a different branch.
    pub fn r#enum(
        &self,
    ) -> std::option::Option<&crate::generated::message_with_complex_one_of::TestEnum> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Enum(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Enum`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_enum<
        T: std::convert::Into<crate::generated::message_with_complex_one_of::TestEnum>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Enum(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Inner`, `None` if the field is not set or
    /// holds a different branch.
    pub fn inner(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::generated::message_with_complex_one_of::Inner>>
    {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Inner(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Inner`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_inner<
        T: std::convert::Into<std::boxed::Box<crate::generated::message_with_complex_one_of::Inner>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Inner(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Duration`, `None` if the field is not set or
    /// holds a different branch.
    pub fn duration(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Duration(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Duration`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_duration<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
        mut self,
        v: T,
    ) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Duration(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `Value`, `None` if the field is not set or
    /// holds a different branch.
    pub fn value(&self) -> std::option::Option<&std::boxed::Box<wkt::Value>> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::Value(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `Value`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_value<T: std::convert::Into<std::boxed::Box<wkt::Value>>>(mut self, v: T) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::Value(v.into()),
        );
        self
    }

    /// The value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// if it holds a `OptionalDouble`, `None` if the field is not set or
    /// holds a different branch.
    pub fn optional_double(&self) -> std::option::Option<&std::boxed::Box<wkt::DoubleValue>> {
        #[allow(unreachable_patterns)]
        self.complex.as_ref().and_then(|v| match v {
            crate::generated::message_with_complex_one_of::Complex::OptionalDouble(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [complex][crate::generated::MessageWithComplexOneOf::complex]
    /// to hold a `OptionalDouble`.
    ///
    /// Note that all the setters affecting `complex` are
    /// mutually exclusive.
    pub fn set_optional_double<T: std::convert::Into<std::boxed::Box<wkt::DoubleValue>>>(
        mut self,
        v: T,
    ) -> Self {
        self.complex = std::option::Option::Some(
            crate::generated::message_with_complex_one_of::Complex::OptionalDouble(v.into()),
        );
        self
    }
}

impl wkt::message::Message for MessageWithComplexOneOf {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithComplexOneOf"
    }
}

/// Defines additional types related to [MessageWithComplexOneOf].
pub mod message_with_complex_one_of {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Inner {
        pub strings: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Inner {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [strings][crate::generated::message_with_complex_one_of::Inner::strings].
        pub fn set_strings<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.strings = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for Inner {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rust.sdk.test.MessageWithComplexOneOf.Inner"
        }
    }

    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum TestEnum {
        Unspecified,
        Black,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [TestEnum::value] or
        /// [TestEnum::name].
        UnknownValue(test_enum::UnknownValue),
    }

    #[doc(hidden)]
    pub mod test_enum {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl TestEnum {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Black => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TEST_ENUM_UNSPECIFIED"),
                Self::Black => std::option::Option::Some("BLACK"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for TestEnum {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for TestEnum {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for TestEnum {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Black,
                _ => Self::UnknownValue(test_enum::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for TestEnum {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TEST_ENUM_UNSPECIFIED" => Self::Unspecified,
                "BLACK" => Self::Black,
                _ => Self::UnknownValue(test_enum::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for TestEnum {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Black => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for TestEnum {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TestEnum>::new(
                ".google.rust.sdk.test.MessageWithComplexOneOf.TestEnum",
            ))
        }
    }

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Complex {
        Null(wkt::NullValue),
        BoolValue(bool),
        BytesValue(::bytes::Bytes),
        StringValue(std::string::String),
        FloatValue(f32),
        DoubleValue(f64),
        Int32(i32),
        Int64(i64),
        Enum(crate::generated::message_with_complex_one_of::TestEnum),
        Inner(std::boxed::Box<crate::generated::message_with_complex_one_of::Inner>),
        Duration(std::boxed::Box<wkt::Duration>),
        Value(std::boxed::Box<wkt::Value>),
        OptionalDouble(std::boxed::Box<wkt::DoubleValue>),
    }
}

/// A test message for f32.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithF32 {
    /// A singular field.
    pub singular: f32,

    /// An optional field.
    pub optional: std::option::Option<f32>,

    /// A repeated field.
    pub repeated: std::vec::Vec<f32>,

    /// A map field, floats cannot be keys, so we only need to test them as
    /// values.
    pub map: std::collections::HashMap<std::string::String, f32>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithF32 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithF32::singular].
    pub fn set_singular<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithF32::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<f32>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithF32::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<f32>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithF32::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<f32>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithF32::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<f32>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithF32 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithF32"
    }
}

/// A test message for f64.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithF64 {
    /// A singular field.
    pub singular: f64,

    /// An optional field.
    pub optional: std::option::Option<f64>,

    /// A repeated field.
    pub repeated: std::vec::Vec<f64>,

    /// A map field, doubles cannot be keys, so we only need to test them as
    /// values.
    pub map: std::collections::HashMap<std::string::String, f64>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithF64 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithF64::singular].
    pub fn set_singular<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithF64::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<f64>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithF64::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<f64>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithF64::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<f64>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithF64::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<f64>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithF64 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithF64"
    }
}

/// A test message for i32.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithI32 {
    /// A singular field.
    pub singular: i32,

    /// An optional field.
    pub optional: std::option::Option<i32>,

    /// A repeated field.
    pub repeated: std::vec::Vec<i32>,

    /// Test i32 as values.
    pub map_value: std::collections::HashMap<std::string::String, i32>,

    /// Test i32 as keys.
    pub map_key: std::collections::HashMap<i32, std::string::String>,

    /// Test i32 as both keys and values.
    pub map_key_value: std::collections::HashMap<i32, i32>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithI32 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithI32::singular].
    pub fn set_singular<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithI32::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<i32>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithI32::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<i32>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithI32::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<i32>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithI32::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<i32>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithI32::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<i32>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithI32::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<i32>,
        V: std::convert::Into<i32>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithI32 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithI32"
    }
}

/// A test message for u32.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithU32 {
    /// A singular field.
    pub singular: u32,

    /// An optional field.
    pub optional: std::option::Option<u32>,

    /// A repeated field.
    pub repeated: std::vec::Vec<u32>,

    /// Test u32 as values.
    pub map_value: std::collections::HashMap<std::string::String, u32>,

    /// Test u32 as keys.
    pub map_key: std::collections::HashMap<u32, std::string::String>,

    /// Test u32 as both keys and values.
    pub map_key_value: std::collections::HashMap<u32, u32>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithU32 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithU32::singular].
    pub fn set_singular<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithU32::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<u32>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithU32::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<u32>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithU32::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<u32>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithU32::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<u32>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithU32::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<u32>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithU32::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<u32>,
        V: std::convert::Into<u32>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithU32 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithU32"
    }
}

/// A test message for i64.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithI64 {
    /// A singular field.
    pub singular: i64,

    /// An optional field.
    pub optional: std::option::Option<i64>,

    /// A repeated field.
    pub repeated: std::vec::Vec<i64>,

    /// Test i64 as values.
    pub map_value: std::collections::HashMap<std::string::String, i64>,

    /// Test i64 as keys.
    pub map_key: std::collections::HashMap<i64, std::string::String>,

    /// Test i64 as both keys and values.
    pub map_key_value: std::collections::HashMap<i64, i64>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithI64 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithI64::singular].
    pub fn set_singular<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithI64::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<i64>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithI64::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<i64>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithI64::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<i64>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithI64::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<i64>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithI64::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<i64>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithI64::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<i64>,
        V: std::convert::Into<i64>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithI64 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithI64"
    }
}

/// A test message for u64.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithU64 {
    /// A singular field.
    pub singular: u64,

    /// An optional field.
    pub optional: std::option::Option<u64>,

    /// A repeated field.
    pub repeated: std::vec::Vec<u64>,

    /// Test u64 as values.
    pub map_value: std::collections::HashMap<std::string::String, u64>,

    /// Test u64 as keys.
    pub map_key: std::collections::HashMap<u64, std::string::String>,

    /// Test u64 as both keys and values.
    pub map_key_value: std::collections::HashMap<u64, u64>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithU64 {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithU64::singular].
    pub fn set_singular<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithU64::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<u64>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithU64::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<u64>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithU64::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<u64>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithU64::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<u64>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithU64::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<u64>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithU64::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<u64>,
        V: std::convert::Into<u64>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithU64 {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithU64"
    }
}

/// A test message for bytes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithBytes {
    /// A singular field.
    pub singular: ::bytes::Bytes,

    /// An optional field.
    pub optional: std::option::Option<::bytes::Bytes>,

    /// A repeated field.
    pub repeated: std::vec::Vec<::bytes::Bytes>,

    /// A map field, bytes cannot be keys, so we only need to test them as
    /// values.
    pub map: std::collections::HashMap<std::string::String, ::bytes::Bytes>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithBytes {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithBytes::singular].
    pub fn set_singular<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithBytes::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<::bytes::Bytes>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithBytes::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<::bytes::Bytes>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithBytes::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<::bytes::Bytes>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithBytes::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<::bytes::Bytes>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithBytes {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithBytes"
    }
}

/// A test message for bool.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithBool {
    /// A singular field.
    pub singular: bool,

    /// An optional field.
    pub optional: std::option::Option<bool>,

    /// A repeated field.
    pub repeated: std::vec::Vec<bool>,

    /// Test bool as map values.
    pub map_value: std::collections::HashMap<std::string::String, bool>,

    /// Test bool as map keys.
    pub map_key: std::collections::HashMap<bool, std::string::String>,

    /// Test bool as map key and value.
    pub map_key_value: std::collections::HashMap<bool, bool>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithBool {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithBool::singular].
    pub fn set_singular<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithBool::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithBool::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<bool>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithBool::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<bool>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithBool::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<bool>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithBool::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<bool>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithBool::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<bool>,
        V: std::convert::Into<bool>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithBool {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithBool"
    }
}

/// A test message for string.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithString {
    /// A singular field.
    pub singular: std::string::String,

    /// An optional field.
    pub optional: std::option::Option<std::string::String>,

    /// A repeated field.
    pub repeated: std::vec::Vec<std::string::String>,

    /// Test string as map values.
    pub map_value: std::collections::HashMap<i32, std::string::String>,

    /// Test string as map keys.
    pub map_key: std::collections::HashMap<std::string::String, i32>,

    /// Test string as map key and value.
    pub map_key_value: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithString {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithString::singular].
    pub fn set_singular<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithString::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithString::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithString::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map_value][crate::generated::MessageWithString::map_value].
    pub fn set_map_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<i32>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key][crate::generated::MessageWithString::map_key].
    pub fn set_map_key<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<i32>,
    {
        use std::iter::Iterator;
        self.map_key = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [map_key_value][crate::generated::MessageWithString::map_key_value].
    pub fn set_map_key_value<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.map_key_value = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithString {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithString"
    }
}

/// A test message for FieldMask.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithRecursion {
    /// A singular field.
    pub singular:
        std::option::Option<std::boxed::Box<crate::generated::message_with_recursion::Level0>>,

    /// An optional field.
    pub optional:
        std::option::Option<std::boxed::Box<crate::generated::message_with_recursion::Level0>>,

    /// A repeated field.
    pub repeated: std::vec::Vec<crate::generated::message_with_recursion::Level0>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<
        std::string::String,
        crate::generated::message_with_recursion::Level0,
    >,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithRecursion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithRecursion::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        self.singular = std::option::Option::Some(std::boxed::Box::new(v.into()));
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithRecursion::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        self.singular = v.map(|x| std::boxed::Box::new(x.into()));
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithRecursion::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        self.optional = std::option::Option::Some(std::boxed::Box::new(v.into()));
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithRecursion::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        self.optional = v.map(|x| std::boxed::Box::new(x.into()));
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithRecursion::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithRecursion::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::generated::message_with_recursion::Level0>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithRecursion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithRecursion"
    }
}

/// Defines additional types related to [MessageWithRecursion].
pub mod message_with_recursion {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Level0 {
        pub level_1:
            std::option::Option<std::boxed::Box<crate::generated::message_with_recursion::Level1>>,

        pub side: std::option::Option<crate::generated::message_with_recursion::NonRecursive>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Level0 {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [level_1][crate::generated::message_with_recursion::Level0::level_1].
        pub fn set_level_1<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::generated::message_with_recursion::Level1>,
        {
            self.level_1 = std::option::Option::Some(std::boxed::Box::new(v.into()));
            self
        }

        /// Sets or clears the value of [level_1][crate::generated::message_with_recursion::Level0::level_1].
        pub fn set_or_clear_level_1<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::generated::message_with_recursion::Level1>,
        {
            self.level_1 = v.map(|x| std::boxed::Box::new(x.into()));
            self
        }

        /// Sets the value of [side][crate::generated::message_with_recursion::Level0::side].
        pub fn set_side<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::generated::message_with_recursion::NonRecursive>,
        {
            self.side = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [side][crate::generated::message_with_recursion::Level0::side].
        pub fn set_or_clear_side<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::generated::message_with_recursion::NonRecursive>,
        {
            self.side = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Level0 {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rust.sdk.test.MessageWithRecursion.Level0"
        }
    }

    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Level1 {
        pub recurse: std::option::Option<std::boxed::Box<crate::generated::MessageWithRecursion>>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Level1 {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [recurse][crate::generated::message_with_recursion::Level1::recurse].
        pub fn set_recurse<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::generated::MessageWithRecursion>,
        {
            self.recurse = std::option::Option::Some(std::boxed::Box::new(v.into()));
            self
        }

        /// Sets or clears the value of [recurse][crate::generated::message_with_recursion::Level1::recurse].
        pub fn set_or_clear_recurse<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::generated::MessageWithRecursion>,
        {
            self.recurse = v.map(|x| std::boxed::Box::new(x.into()));
            self
        }
    }

    impl wkt::message::Message for Level1 {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rust.sdk.test.MessageWithRecursion.Level1"
        }
    }

    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct NonRecursive {
        pub value: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl NonRecursive {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [value][crate::generated::message_with_recursion::NonRecursive::value].
        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.value = v.into();
            self
        }
    }

    impl wkt::message::Message for NonRecursive {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rust.sdk.test.MessageWithRecursion.NonRecursive"
        }
    }
}

/// A test message for Value.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::Value>,

    /// An optional field.
    pub optional: std::option::Option<wkt::Value>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::Value>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<std::string::String, wkt::Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithValue::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithValue::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Value>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Value>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::Value>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithValue"
    }
}

/// A test message for Struct.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithStruct {
    /// A singular field.
    pub singular: std::option::Option<wkt::Struct>,

    /// An optional field.
    pub optional: std::option::Option<wkt::Struct>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::Struct>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<std::string::String, wkt::Struct>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithStruct {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithStruct::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithStruct::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithStruct::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithStruct::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithStruct::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Struct>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithStruct::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::Struct>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithStruct {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithStruct"
    }
}

/// A test message for ListValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithListValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::ListValue>,

    /// An optional field.
    pub optional: std::option::Option<wkt::ListValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::ListValue>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<std::string::String, wkt::ListValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithListValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithListValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithListValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithListValue::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithListValue::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithListValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::ListValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithListValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::ListValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithListValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithListValue"
    }
}

/// A test message for NullValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithNullValue {
    /// A singular field.
    pub singular: wkt::NullValue,

    /// An optional field.
    pub optional: std::option::Option<wkt::NullValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::NullValue>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<std::string::String, wkt::NullValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithNullValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithNullValue::singular].
    pub fn set_singular<T: std::convert::Into<wkt::NullValue>>(mut self, v: T) -> Self {
        self.singular = v.into();
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithNullValue::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::NullValue>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithNullValue::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::NullValue>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithNullValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::NullValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithNullValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::NullValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithNullValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithNullValue"
    }
}

/// A test message for FieldMask.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithFieldMask {
    /// A singular field.
    pub singular: std::option::Option<wkt::FieldMask>,

    /// An optional field.
    pub optional: std::option::Option<wkt::FieldMask>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::FieldMask>,

    /// A map field, messages cannot be keys.
    pub map: std::collections::HashMap<std::string::String, wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithFieldMask {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithFieldMask::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithFieldMask::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [optional][crate::generated::MessageWithFieldMask::optional].
    pub fn set_optional<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.optional = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [optional][crate::generated::MessageWithFieldMask::optional].
    pub fn set_or_clear_optional<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.optional = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithFieldMask::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::FieldMask>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithFieldMask::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::FieldMask>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithFieldMask {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithFieldMask"
    }
}

/// A test message for google.protobuf.FloatValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithFloatValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::FloatValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::FloatValue>,

    /// Test google.protobuf.FloatValue as amap values.
    pub map: std::collections::HashMap<std::string::String, wkt::FloatValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithFloatValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithFloatValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FloatValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithFloatValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FloatValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithFloatValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::FloatValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithFloatValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::FloatValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithFloatValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithFloatValue"
    }
}

/// A test message for google.protobuf.DoubleValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithDoubleValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::DoubleValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::DoubleValue>,

    /// Test google.protobuf.DoubleValue as map values.
    pub map: std::collections::HashMap<std::string::String, wkt::DoubleValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithDoubleValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithDoubleValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::DoubleValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithDoubleValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::DoubleValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithDoubleValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::DoubleValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithDoubleValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::DoubleValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithDoubleValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithDoubleValue"
    }
}

/// A test message for google.protobuf.Int32Value.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithInt32Value {
    /// A singular field.
    pub singular: std::option::Option<wkt::Int32Value>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::Int32Value>,

    /// Test google.protobuf.Int32Value as map values.
    pub map: std::collections::HashMap<std::string::String, wkt::Int32Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithInt32Value {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithInt32Value::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Int32Value>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithInt32Value::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Int32Value>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithInt32Value::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Int32Value>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithInt32Value::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::Int32Value>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithInt32Value {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithInt32Value"
    }
}

/// A test message for u32.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithUInt32Value {
    /// A singular field.
    pub singular: std::option::Option<wkt::UInt32Value>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::UInt32Value>,

    /// Test google.protobuf.UInt32Value as map values.
    pub map: std::collections::HashMap<std::string::String, wkt::UInt32Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithUInt32Value {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithUInt32Value::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::UInt32Value>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithUInt32Value::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::UInt32Value>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithUInt32Value::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::UInt32Value>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithUInt32Value::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::UInt32Value>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithUInt32Value {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithUInt32Value"
    }
}

/// A test message for google.protobuf.Int64Value.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithInt64Value {
    /// A singular field.
    pub singular: std::option::Option<wkt::Int64Value>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::Int64Value>,

    /// Test google.protobuf.Int64Value as values.
    pub map: std::collections::HashMap<std::string::String, wkt::Int64Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithInt64Value {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithInt64Value::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Int64Value>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithInt64Value::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Int64Value>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithInt64Value::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Int64Value>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithInt64Value::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::Int64Value>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithInt64Value {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithInt64Value"
    }
}

/// A test message for google.protobuf.Int64Value.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithUInt64Value {
    /// A singular field.
    pub singular: std::option::Option<wkt::Int64Value>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::Int64Value>,

    /// Test google.protobuf.Int64Value as values.
    pub map: std::collections::HashMap<std::string::String, wkt::Int64Value>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithUInt64Value {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithUInt64Value::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Int64Value>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithUInt64Value::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Int64Value>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithUInt64Value::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Int64Value>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithUInt64Value::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::Int64Value>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithUInt64Value {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithUInt64Value"
    }
}

/// A test message for google.protobuf.BytesValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithBytesValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::BytesValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::BytesValue>,

    /// A map field, google.protobuf.BytesValue cannot be keys, so we only need to
    /// test them as values.
    pub map: std::collections::HashMap<std::string::String, wkt::BytesValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithBytesValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithBytesValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::BytesValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithBytesValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::BytesValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithBytesValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::BytesValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithBytesValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::BytesValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithBytesValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithBytesValue"
    }
}

/// A test message for google.protobuf.BoolValue.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithBoolValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::BoolValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::BoolValue>,

    /// Test google.protobuf.BoolValue as map values.
    pub map: std::collections::HashMap<std::string::String, wkt::BoolValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithBoolValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithBoolValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::BoolValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithBoolValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::BoolValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithBoolValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::BoolValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithBoolValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::BoolValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithBoolValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithBoolValue"
    }
}

/// A test message for string.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageWithStringValue {
    /// A singular field.
    pub singular: std::option::Option<wkt::StringValue>,

    /// A repeated field.
    pub repeated: std::vec::Vec<wkt::StringValue>,

    /// Test string as map values.
    pub map: std::collections::HashMap<std::string::String, wkt::StringValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MessageWithStringValue {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [singular][crate::generated::MessageWithStringValue::singular].
    pub fn set_singular<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.singular = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [singular][crate::generated::MessageWithStringValue::singular].
    pub fn set_or_clear_singular<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::StringValue>,
    {
        self.singular = v.map(|x| x.into());
        self
    }

    /// Sets the value of [repeated][crate::generated::MessageWithStringValue::repeated].
    pub fn set_repeated<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::StringValue>,
    {
        use std::iter::Iterator;
        self.repeated = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [map][crate::generated::MessageWithStringValue::map].
    pub fn set_map<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<wkt::StringValue>,
    {
        use std::iter::Iterator;
        self.map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for MessageWithStringValue {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rust.sdk.test.MessageWithStringValue"
    }
}
